package com.czy;


import javax.swing.*;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class 消息弹窗 {
    static ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);

    public static void main(String[] args) throws IOException, InterruptedException {
        send();
        // 保证程序不被退出
        System.in.read();
    }

    private static void send() {
        CompletableFuture.runAsync(() -> {
            JOptionPane.showMessageDialog(null,"Hello World","提示",JOptionPane.INFORMATION_MESSAGE);
        });
        System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()));
        scheduledExecutorService.schedule(消息弹窗::send,30, TimeUnit.MINUTES);
    }

}
